package com.rd.sys.service.sys.user.impl;

import baseproj.common.exception.BaseServiceException;
import baseproj.inter.Message;

import com.rd.sys.common.base.CommonConstants;

/**
 * The Class UserInfoServiceException.
 */
public class UserLoginServiceException extends BaseServiceException {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 1L;

    public static final int ACCOUNT_OR_PASSWORD_ERROR = 1;

    public static final int USERNAME_EXIST_ERROR = 2;

    public static final int USERNAME_NOT_CONDITIONS = 3;

    public static final int LOGIN_VALIDCODE_INVALID = 4;

    /**
     * Instantiates a new user info service exception.
     * 
     * @param erroCode
     *            the erro code
     */
    public UserLoginServiceException(int erroCode) {
        super(erroCode);
        if (erroCode == ACCOUNT_OR_PASSWORD_ERROR) {
            // 账号或密码错误
            this.setErroDesc(Message.getMessage("login.account_or_password.erro"));
        }
        if (erroCode == USERNAME_EXIST_ERROR) {
            // 账号或密码错误
            this.setErroDesc("登录账号已使用.");
        }
        if (erroCode == USERNAME_NOT_CONDITIONS) {
            // 账号或密码错误
            this.setErroDesc("登录账号不满足条件，不能以" + CommonConstants.UserConstats.USER_CODE_PRIFIX + "(不区分大小写)开头.");
        }

        if (erroCode == LOGIN_VALIDCODE_INVALID) {
            // 验证码不正确
            this.setErroDesc(Message.getMessage("login.validcode.invalid"));
        }

    }
}
